Generating Rewritable Abstract Syntax Trees A Foundation for the Rapid Development of Source Code Transformation Tools

نویسندگان

  • Jeffrey L. Overbey
  • Ralph E. Johnson
چکیده

Building a production-quality refactoring engine or similar source code transformation tool traditionally requires a large amount of hand-written, language-specific support code. We describe a system which reduces this overhead by allowing both a parser and a fully rewritable AST to be generated automatically from an annotated grammar, requiring little or no additional handwritten code. The rewritable AST is ideal for implementing program transformations that preserve the formatting of the original sources, including spacing and comments, and the system can be augmented to allow transformation of Cpreprocessed sources even when the target language is not C or C++. Moreover, the AST design is fully customizable, allowing it to resemble a hand-coded tree. The amount of required annotation is typically quite small, and the annotated grammar is often an order of magnitude smaller than the generated code.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Generating Refactoring Implementations from Platform Independent Metamodel Transformations

Increasingly more developers are applying refactorings program transformations that can improve the design of existing source code to make their software more easily adaptable to new requirements. Because small changes to object-oriented software (such as renaming a class) can require a lot of updates to several source files, tools that automatically update the affected files can save these dev...

متن کامل

Rewritable Reference Attributed Grammars design, implementation, and applications

This thesis presents an object-oriented technique for rewriting abstract syntax trees in order to simplify compilation. The technique, Rewritable Reference Attributed Grammars (ReRAGs), is completely declarative and supports both rewrites and computations by means of attributes. We have implemented ReRAGs in our aspect-oriented compiler compiler tool JastAdd II. We present the ReRAG formalism, ...

متن کامل

Fine-grained Software Version Control Based on a Program’s Abstract Syntax Tree

The Envision project aims to develop an integrated development environment (IDE) for object-oriented languages that features a visual structured code editor and is used for large-scale software development. To achieve this goal Envision works directly on an abstract syntax tree instead of a text-based source code representation. This thesis features the design of a version control system based ...

متن کامل

Towards Portable Source Code Representations using XML

One of the most important issue in source code analysis and software re-engineering is the representation of source code text at an abstraction level and form suitable for algorithmic processing. Moreover, source code representation schemes must be compact, accessible by well defined application programming interfaces (APIs) and above all portable to different operating platforms and various CA...

متن کامل

Partitioners Track: Generating Security Vulnerabilities in Source Code

This paper describes a framework, which modifies existing source code to generate security issues. An example plugin for generating SQL injection in Java source code is described. The generation process is based on static code analysis techniques like dataflow analysis and abstract syntax trees. The framework is evaluated with the help of Java projects from GitHub. One modified project was succ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2008